package com.example.main;

/**
 * ClassName: MyTest3
 * Package: com.example.main
 * Description:
 *
 * @Author 许启萌
 * @Create 2025/6/30 14:25
 * @Version 1.0
 */
public class Main {
    public static void main(String[] args) {
        System.out.println("100以内的质数数量："+func1());
    }
    public static int func1(){
        long start = System.currentTimeMillis();
        int count = 0 ;
        boolean isPrime = true ;
        for(int i = 2 ; i <= 100; i++){
            for(int j = 2 ; j < (int)(Math.sqrt(i)) ; j++ ){
                if( i%j ==0 ){
                    isPrime = false ;
                    break; //break j
                }
            }
            if(isPrime == true){
                count++ ;
            }
            isPrime = true ;
        }
        long end = System.currentTimeMillis();
        System.out.println("运行时间："+(end-start)+" 毫秒");
        return count;
    }
}
